﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace MashGen.Engine.Expressions
{
    public class Number : AbstractExpression
    {
        public uint Value { get; private set; }

        public Number(uint value)
        {
            Value = value;
        }

        public override R Vist<R, P>(IExpressionVisitor<R, P> visitor, P parameter = default(P))
        {
            return visitor.VisitNumber(this, parameter);
        }

        public override bool Equals(AbstractExpression other)
        {
            var otherNumber = other as Number;
            if (ReferenceEquals(otherNumber, null))
            {
                return false;
            }
            return Value.Equals(otherNumber.Value);
        }

        public override int GetHashCode()
        {
            return (int)Value;
        }
    }
}
